const AdvertiServices = require("../../services/admin/AdvertiServices")

const AdvertiController = {
    add:async (req,res)=>{
        const result =  await AdvertiServices.add(req.body)
        console.log('返回：',result);
        if (result) {
            res.send({
                ActionType:"ok",
                msg:'添加成功'
            })
        } else {
            res.send({
                code:"500",
                msg:'添加失败'
            })
        }
        
    },
    getList:async (req,res)=>{
        const result =  await AdvertiServices.getList(req.body)
        // console.log('返回：',result);
        res.send({
            ActionType:"ok",
            msg:'查询成功',
            data:result
        })
    },
    update:async (req,res)=>{
        const result =  await AdvertiServices.update(req.body)
        console.log('返回：',result);
        if (result) {
            res.send({
                ActionType:"ok",
                msg:'修改成功',
                data:result
            })
        } else {
            res.send({
                code:"500",
                msg:'修改失败'
            })
        }
        
    },
    delete:async (req,res)=>{
        console.log('req',req.body)
        const result =  await AdvertiServices.delete(req.body)
        console.log('返回：',result);
        if (result) {
            res.send({
                ActionType:"ok",
                msg:'删除成功',
                data:result
            })
        } else {
            res.send({
                code:"500",
                msg:'删除失败'
            })
        }
        
    },
}

module.exports = AdvertiController